package com.yoomiito.app.widget.dialog;

import android.content.Context;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;

import com.yoomiito.app.R;

public class VIPTipDialog extends BaseDialog implements View.OnClickListener {

    private View.OnClickListener mOnClickListener;

    public VIPTipDialog(@NonNull Context context) {
        this(context,0);
    }

    public VIPTipDialog(@NonNull Context context, int themeResId) {
        super(context, R.style.dialog_2);
    }

    protected VIPTipDialog(@NonNull Context context, boolean cancelable, @Nullable OnCancelListener cancelListener) {
        super(context, cancelable, cancelListener);
    }

    @Override
    public View setView() {
        View view = LayoutInflater.from(mContext).inflate(R.layout.dialog_vip_tip,null);
        view.findViewById(R.id.dialog_vip_tip_iv).setOnClickListener(this);
        view.findViewById(R.id.dialog_vup_tip_cancel).setOnClickListener(this);
        setCanceledOnTouchOutside(true);
        setWidthPercent(1);

        return view;
    }

    public void setOnClickListener(View.OnClickListener onClickListener) {
        mOnClickListener = onClickListener;
    }


    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.dialog_vip_tip_iv:
                if (mOnClickListener!=null){
                    mOnClickListener.onClick(v);
                }
                break;
            case R.id.dialog_vup_tip_cancel:
                dismiss();
                break;
        }
    }
}
